class Solution:
    def trailingZeroes(self, n: int) -> int:
        res, i = 0, 1
        while 5 ** i <= n:
            res += n // (5 ** i)
            i += 1
        return res


a = Solution()
# print(a.trailingZeroes(3))
# print(a.trailingZeroes(5))
# print(a.trailingZeroes(12))
print(a.trailingZeroes(124))
print(a.trailingZeroes(125))
print(a.trailingZeroes(5 ** 5))
print(a.trailingZeroes(5 ** 5 - 1))
# for i in range(500):
#     print(a.trailingZeroes(i))
